159c54d9ec44f8ecca9b3debc6444ebae98df279,src/main/java/org/elasticsearch/cassandra/index/OptimizedElasticSecondaryIndex.java,MappingInfo,MappingInfo,#ClusterState#,598

Before Change


                String index = indexMetaData.getIndex();
                MappingMetaData mappingMetaData; 
                ClusterBlockException clusterBlockException = state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, index);
                if (clusterBlockException == null && 
                    state.routingTable().isLocalShardsStarted(index) &&
                    ( OptimizedElasticSecondaryIndex.this.baseCfs.metadata.ksName.equals(index) || 
                      OptimizedElasticSecondaryIndex.this.baseCfs.metadata.ksName.equals(indexMetaData.getSettings().get(IndexMetaData.SETTING_KEYSPACE_NAME))) &&
                    ((mappingMetaData = indexMetaData.mapping(OptimizedElasticSecondaryIndex.this.baseCfs.metadata.cfName)) != null)
                   ) {
                    try {

After Change


            
            Map<String, Boolean> fieldsMap = new HashMap<String, Boolean>();
            for(Iterator<IndexMetaData> indexMetaDataIterator = state.metaData().iterator(); indexMetaDataIterator.hasNext(); ) {
                IndexMetaData indexMetaData = indexMetaDataIterator.next();
                String index = indexMetaData.getIndex();
                MappingMetaData mappingMetaData; 
                ClusterBlockException clusterBlockException = state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, index);
                if (clusterBlockException != null) {
                    logger.debug("ignore, index=[{}] blocked blocks={}", index, clusterBlockException.blocks());
                    continue;
                }
                if (!state.routingTable().isLocalShardsStarted(index)) {
                    logger.debug("ignore, local shard not started for index=[{}]", index);
                    continue;
                }
                
                if ( (OptimizedElasticSecondaryIndex.this.baseCfs.metadata.ksName.equals(index) || OptimizedElasticSecondaryIndex.this.baseCfs.metadata.ksName.equals(indexMetaData.keyspace())) &&
                     ((mappingMetaData = indexMetaData.mapping(OptimizedElasticSecondaryIndex.this.baseCfs.metadata.cfName)) != null)
                   ) {
                    try {